<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/admin.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 会议列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">

                <li> <a id="room" class="button border-main icon-plus-square-o" href="javascript:void(0)" onclick="return del(${id},${maxnumber})" >预定该会议室</a> </li>
                <li>
                    开始时间：<input type="datetime-local" id="start" />
                    结束时间：<input type="datetime-local" id="end" />
<%--                    <input type="text" id="start" placeholder="请输入开始时间" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />--%>
<%--                    <input type="text" id="end" placeholder="请输入结束时间" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />--%>
                 ！！请选择未被预定的时间段预定您的会议
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">会议室ID</th>
                <th>会议室</th>
                <th >已被预定的会议开始时间</th>
                <th >已被预定的会议结束时间</th>
                <th width="310">操作</th>
            </tr>
            <c:forEach items="${boardRoomTime}" var="boardRoom" varStatus="status">

                <tr>
                    <td id="id" style="text-align:left; padding-left:20px;">
                            ${boardRoom.id}
                    </td>

                    <td>${boardRoom.name}</td>
                    <td>${boardRoom.tstart}</td>
                    <td>${boardRoom.tend}</td>
                    <td>
                        <div class="button-group">
                            <a class="button border-main" href="">
                                <span class="icon-edit"></span> 开会
                            </a> &nbsp;

                        </div>
                    </td>
                </tr>
            </c:forEach>

            <tr>
                <td colspan="8"><div class="pagelist">
                    <a href="MeetingServlet?flag=1&page=1">首页</a>
                    <a href="MeetingServlet?flag=1&page=${page-1}">上一页</a>
                    <a href="MeetingServlet?flag=1&page=${page+1}">下一页</a>
                    <a href="MeetingServlet?flag=1&page=${totalPage}">尾页</a> </div></td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">



    function del(Id,maxnumber) {
        //alert(Id);
        var start= document.getElementById("start").value;
      //  alert(start);
        var end= document.getElementById("end").value;
       // alert(end);
        var xmlhttp;
        if (window.XMLHttpRequest)
        {
            //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            // IE6, IE5 浏览器执行代码
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET","http://localhost:8080/Meeting_war_exploded/servlet/BoardroomServlet?flag=8&id="+Id+"&start="+start+"&end="+end);
        xmlhttp.send();
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
               // alert(this.responseText);
                if(this.responseText =='true'){
                    location.href="MeetingServlet?flag=6&maxnumber="+maxnumber+"&roomid="+Id+"&start="+start+"&end="+end;
                }else{
                    alert("该会议室在该时间段已经被预定！！！");
                }

            }
        }


    }




    function mydel(Id){
        //alert(teaId);
        if(confirm("您确定要删除吗？")){
            //alert(this);
            var str = "MeetingServlet?flag=5&id=" + Id;
            location.href= str;
        }
    }

    //搜索
    function changesearch(){
        var keyWord = $("#keyWord").val();
        var searchId = $("#serachId").val();
        location.href="MeetingServlet?flag=6&id=" + searchId + "&keyWord=" + keyWord;
    }


</script>
</body>
</html>